#include "syscall.h"
#include "user.h"

void main()
{
	int firstLock;
	int secondLock; 
	int firstCV; 
	int i,j;
	firstLock= rpcCreateLock("wuyuzhe",sizeof("wuyuzhe"));
	Printf("the first lock I created is wuyuzhe\n");
	secondLock = rpcCreateLock("weiqiaosong",sizeof("weiqiaosong"));
	Printf("the second lock I created is weiqiaosong\n");
	firstCV = rpcCreateCondition("qiaoge",sizeof("qiaoge"));
	Printf("the first CV I created is qiaoge\n");
	Printf("Try to acquire the first lock\n");
	rpcAcquireLock(firstLock);
	Printf("Acquire the first lock succssfully and try to acquire the second lock\n");
	rpcAcquireLock(secondLock);
	Printf("Acquire the second lock successfully, you may use ctrl + C to terminate the nachos now.\n");
	for(i=0;i<1000;i++){
		for(j=0;j<500;j++){}
	}
	rpcReleaseLock(firstLock);
	rpcReleaseLock(secondLock);
	Halt();
}